import { createRouter, createWebHistory } from 'vue-router'
import { defineComponent, defineAsyncComponent } from 'vue'
import HomeView from '../views/home/index.vue'
import Layout from '@/layout/index.vue'

// const TellRiskView = defineAsyncComponent(() => import('@/views/tell-risk/index.vue'))

const router = createRouter({
  history: createWebHistory('/admin/'),
  routes: [
    {
      path: '/',
      name: 'home1',
      component: Layout,
      children: [
        {
          path: '/',
          redirect: '/home'
        },
        {
          path: '/home',
          name: 'home',
          component: HomeView
        },
        // {
        //   path: '/tell-risk',
        //   name: 'tell-risk',
        //   component: TellRiskView
        // },
      ]
    },
    {
      path: '/about',
      name: 'about',
      // route level code-splitting
      // this generates a separate chunk (About.[hash].js) for this route
      // which is lazy-loaded when the route is visited.
      component: () => import('../views/AboutView.vue'),
    },
    {
      path: '/login',
      name: 'login',
      component: () => import('@/views/login/index.vue'),
    },
  ],
})

export default router
